Skip to content

Move the codex configuration into the domain with read and publish stages - #4936

Open
Mpdreamz wants to merge 3 commits into
split/integration-wave2from
split/09-codex
Open

Mpdreamz wants to merge 3 commits into
split/integration-wave2from
split/09-codex

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Load codex.yml into a CodexConfiguration record through a declared loader, with the publishing check as its own stage type. Behaviour is unchanged: messages, exceptions and file attribution are those of main.

Affects: Configuration, CLI

Why

Part of #4530. The codex configuration is a mutable class that deserializes itself, and the environment check sits in the consumer's loader as an if. Moving it into the domain gives it the same shape as the other aggregates (record, DTO, loader, named rules).

What

Codex domain record

CodexConfiguration, CodexGroupDefinition and CodexDocumentationSetReference move to Elastic.Documentation.Codex as value-equal records with internal setters. CodexDocumentationSetReference.ForRepository replaces the object initializers in the clone service and the style-guide preview. The unused GetGitUrl() on the reference is gone (the clone service has its own).

Stage types

A codex is checked by CodexConfiguration.Constraints when read (sync, update-redirects) and by PublishedCodexConfiguration.Constraints when published (it must name its environment). Each stage has one static rule set; the loader never chooses one and nothing composes rules at a call site. The read set is empty on purpose: main accepts every value, and the empty set exists so every loaded type has a static T.Constraints (Loader.For requires it). A test pins it as empty, so a rule added in a refactor PR fails deliberately; the deferred group rules need their own PR with a snapshot diff. No caller dispatches, so there is no union.

Loader

CodexSiteLoader declares Read and Publish loaders over CodexConfigurationDto, with Load(text, file), LoadForPublish(text, file) and a throwing Load(IFileInfo) for codex sync, which has always thrown. CodexConfigurationLoader keeps its TryLoad signatures and reports errors as global errors with main's text.

Tests

Loader tests (DTO projection, normalization, malformed YAML, environment message), the stage's AutoTest axes, and the DomainPurityTests namespace entry. No verified snapshot changes.

Deferred behaviour changes (all in #4530, not here):

  • Codex group id, group name, duplicate group id and canonical_base_url absolute-URI warnings.
  • D29 codex.group names a group the codex does not define (DocumentationSetInCodex).
  • Reordering of the GlobalCliOptions parameter in the codex commands.
  • codex sync loading through the checked loader (it still throws as on main).

Known difference: an error from a YAML parse failure is now written without the original exception attached (EmitGlobalError(message)); the text is unchanged.

Stack: 5 of the wave-2 stack. Part of #4530; builds on the foundation #4888, the wave-1 PRs, and #4926, #4931 and #4930, via split/integration-wave2.

Verify

mise run build && mise run test && CI=true mise run test && mise run lint && mise run snap:status

🤖 Generated with Claude Code

Golden compare

Local builds of the isolated docs, the prod assembler site and the codex example site, this branch's head against the wave-1 integration branch (split/integration-wave1: current main plus the nine wave-1 PRs); aggregate counts, the output stays local.

21 paths differ across the three sites. All also differ between two captures of that baseline taken hours apart (159 paths: live OpenAPI specs, the release-notes CDN and the generated llms files), so none of these can be attributed to this change. The capture was taken at an earlier head; the current head adds only a comment and a test.

Limit: golden cannot show a real change inside those drifting pages.

…tage

codex.yml is loaded into CodexConfiguration through a declared loader. A codex that is published is the next stage, PublishedCodexConfiguration, which carries the environment rule; reading one (sync, update-redirects) needs none. Messages, exceptions and file attribution are those of main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The set exists so every loaded type has a static T.Constraints, which Loader.For requires. A test fails when a rule is added, so a refactor PR cannot change what the codex commands report by accident.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An empty or null groups key, and an empty entry under it, load again.
They fail only where a group is looked up, as before, so codex sync
and codex update-redirects read such files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
assembler-preview — db563069 Deployed Nov 19, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant